package com.ruoyi.business.controller;

import com.ruoyi.business.service.IWsdRoleClassService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.entity.WsdRoleClass;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 角色与班级绑定Controller
 * 
 * @author ruoyi
 * @date 2024-05-09
 */
@RestController
@RequestMapping("wsd_role_class")
public class WsdRoleClassController extends BaseController {

    @Autowired
    private IWsdRoleClassService wsdRoleClassService;

    /**
     * 查询角色与班级绑定
     */
    @PreAuthorize("@ss.hasPermi('business:class:list')")
    @GetMapping("/list")
    public TableDataInfo list( WsdRoleClass wsdRoleClass) {
        startPage();
        List<WsdRoleClass> list = wsdRoleClassService.selectWsdRoleClassList(wsdRoleClass);
        return getDataTable(list);
    }

    /**
     * 修改角色与班级绑定
     */
    @PreAuthorize("@ss.hasPermi('business:class:edit')")
    @Log(title = "角色与班级绑定", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WsdRoleClass wsdRoleClass) {
        return AjaxResult.success(wsdRoleClassService.updateWsdRoleClass(wsdRoleClass));
    }

}
